﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Deixei;

using Deixei.Domain;
using Deixei.Infrastructure;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;

namespace Deixei.Web.Controllers
{
    public abstract class DeixeiApiController : ApiController
    {
        public DeixeiApiController() : base()
        {
        }

        public DeixeiApiController(ApplicationContext appContext)
            : this()
        {
            _appContext = ( appContext ?? new ApplicationContext() );
        }

        //properties

        private ApplicationContext _appContext = null;

        public ApplicationContext ApplicationContext
        {
            get
            {
                if (_appContext == null)
                {
                    _appContext = new ApplicationContext();
                }
                return _appContext;
            }
            set
            {
                _appContext = value;
            }
        }


        protected override void Dispose(bool disposing)
        {
            //UnitOfWork.Dispose();
            base.Dispose(disposing);
        }
    }
}
